<!DOCTYPE html>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新的回复</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta content="width=device-width, initial-scale=1" name="viewport">
<link rel="stylesheet" type="text/css" href="${contextPath}/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="${contextPath}/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="${contextPath}/css/public.css">
<script type="text/javascript" src="${contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${contextPath}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${contextPath}/js/common.js"></script>
<style type="text/css">
	.wrapLi:hover {
		background: #f6f7f8;
	}
	.replyTime {
		float: right;
	}
	.targetInfo {
		border:1px solid rgba(0,0,0,0.05);padding: 10px;overflow: hidden; background: #FFFFFF;margin-bottom: 10px;  position: relative;
	}
</style>
</head>
<body>
	<div class="container">
		<div class="panel panel-default" id="waitInspCommentList">
			<div class="panel-heading">新的回复</div>
			<div class="panel-body">
				<ul class="list-group" id="msgUl">
					
				</ul>
				<div id="moreMsgDiv" class="list-group" style="text-align: center; display: none;">
					<a id="moreMsg" href="javascript:getReplyList();" class="list-group-item">显示更多</a>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript">
	var replyNum = 0;
	$(document).ready(function () {
		getReplyList();
	});
	getReplyList = function () {
		$.ajax({
			type: 'POST',
			url: '${contextPath}/security/getSelfReplyList',
			data: {"begin": replyNum},
			dataType: 'json',
			success: function (data) {
				var msgUlContent="";
				if(data.list==""){
					msgUlContent = '<li class="list-group-item wrapLi">暂无消息</li>';
					$("#msgUl").html("");
					$("#msgUl").append(msgUlContent);
				}else{
					replyNum = data.list.length;
					$.each(data.list,function (i, item) {
						$("#msgUl").append('<li class="list-group-item wrapLi">'+
							'<div>'+
								'<span>'+item.createUsername+'</span>'+
								'<span class="replyTime">'+item.createTime+'</span>'+
							'</div>'+
							'<div>'+
								'<div>'+
									'<p>'+item.content+'</p>'+
								'</div>'+
								'<div class="targetInfo">'+
									'<a href="${contextPath}/security/showArticleContent?id='+item.articleId+'" target="_blank" style="text-decoration: none; color: #000;">'+
										'<span>'+item.targetUsername+'：</span>'+
										'<span>'+item.targetContent+'</span>'+
									'</a>'+
								'</div>'+
							'</div>'+
						'</li>'
						);
					});
					if($(".wrapLi").length<data.totle){
						$("#moreMsgDiv").show();
					}else{
						$("#moreMsg").addClass("disabled");
						$("#moreMsg").click(function(){
							return false;
						});
					}
				}
			}
		});
	};
</script>
</body>
</html>
